$INCLUDE: 'C:\FG\FASTGRAF.FI'

      PROGRAM MAIN

      INTEGER HANDLE, OLD_MODE, STATUS
      INTEGER FG_GETMODE, FG_LOADPCX, FG_TESTMODE, FG_VBALLOC, FG_VBOPEN

      CALL FG_INITPM
      IF (FG_TESTMODE(19,1) .EQ. 0) THEN
         STOP 'This program requires a 320 x 200 MCGA graphics mode.'
      END IF
      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(19)
      CALL FG_VBINIT

      HANDLE = FG_VBALLOC(320,200)
      IF (HANDLE .LT. 0) THEN
         CALL FG_SETMODE(OLD_MODE)
         CALL FG_RESET
         STOP 'Could not create the virtual buffer.'
      END IF
      STATUS = FG_VBOPEN(HANDLE)

      STATUS = FG_LOADPCX('CORAL.PCX'//CHAR(0),0)
      IF (STATUS .EQ. 0) THEN
         CALL FG_VBPASTE(0,319,0,199,0,199)
         CALL FG_WAITKEY
      END IF

      CALL FG_VBCLOSE
      CALL FG_VBFREE(HANDLE)
      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      IF (STATUS .EQ. 1) THEN
         STOP 'CORAL.PCX not found.'
      ELSE IF (STATUS .EQ. 2) THEN
         STOP 'CORAL.PCX is not a PCX file.'
      ELSE
         STOP ' '
      ENDIF
      END
